package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 售后退货申请请操作类型枚举
 * @author 伍将
 * @date 2020/11/20
 * @version 2.0.0
 */
public enum AfterSaleReturnApplyOperateTypeEnum {

    /**
     * 待提交退货申请单
     */
    TO_BE_COMMIT(1, "待提交退货申请单", "/memberCenter/afterService/returnApplication/returnPrSubmit"),
    /**
     * 待新增退货发货单
     */
    TO_BE_ADD_DELIVERY(2, "待新增退货发货单", "/memberCenter/afterService/returnApplication/returnPrAddDeliver"),
    /**
     * 待新增物流单
     */
    TO_BE_ADD_LOGISTICS(3, "待新增物流单", "/memberCenter/afterService/returnApplication/returnPrAddLogistics"),
    /**
     * 待退货发货
     */
    TO_BE_DELIVERY(4, "待退货发货", "/memberCenter/afterService/returnApplication/returnPrDeliver"),
    /**
     * 待确认退货回单
     */
    TO_BE_CONFIRM_RECEIPT(5, "待确认退货回单", "/memberCenter/afterService/returnApplication/returnPrConfirmBack"),
    /**
     * 待确认退款结果
     */
    TO_BE_CONFIRM_REFUND(6, "待确认退款结果", "/memberCenter/afterService/returnApplication/returnPrConfirmResult"),
    /**
     * 待确认售后完成
     */
    TO_BE_CONFIRM_COMPLETE(7, "待确认售后完成", "/memberCenter/afterService/returnApplication/returnPrConfirmFinish");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    AfterSaleReturnApplyOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static AfterSaleReturnApplyOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(AfterSaleReturnApplyOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
